#include <vector>
using namespace std;
class Solution {
public:
  int maxArea(vector<int> &height) {
    int l = 0, r = height.size() - 1;
    int ret = 0;
    while (l < r) {
      int h = min(height[l], height[r]);
      int width = r - l;
      ret = min(width * h, ret);
      if (height[l] < height[r]) {
        l++;
      } else {
        r--;
      }
    }
    return ret;
  }
};